package com.a01_2021.thousandstimes.general.service.impl;

import com.a01_2021.thousandstimes.general.entity.EnglishComputer;
import com.a01_2021.thousandstimes.general.mapper.EnglishComputerMapper;
import com.a01_2021.thousandstimes.general.service.EnglishComputerService;
import com.a01_2021.thousandstimes.saas.entity.OpenRecruitment;
import com.a01_2021.thousandstimes.utils.AjaxResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: thousandstimes
 * @description:
 * @author: FRQ
 * @create: 2021-04-02 17:07
 **/
@Service
public class EnglishComputerServiceImpl extends ServiceImpl<EnglishComputerMapper, EnglishComputer> implements EnglishComputerService {

    @Autowired
    private EnglishComputerMapper englishComputerMapper;


    @Override
    public AjaxResponse insert(EnglishComputer englishComputer) {
//        englishComputer.setUserId(new Long((long)1));
//        englishComputer.setEnglishId(1);
//        englishComputer.setComputerId(1);
        englishComputerMapper.insert(englishComputer);
        return AjaxResponse.success("添加成功");
    }

    @Override
    public EnglishComputer selectByUserId(Long userId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("user_id",userId);
        EnglishComputer englishComputer = englishComputerMapper.selectOne(queryWrapper);
        return englishComputer;
    }
}
